home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 03.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-05-05  |  5.7 KB  |  303 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18. call Settings()
  19. call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20. line = readln(TempFile)
  21. Type = strip(line)
  22. line = readln(TempFile)
  23. Texture = strip(line)
  24. call close (TempFile)
  25. j=0
  26. TFrames = Frames
  27. if Field = 1 then TFrames = Frames*2
  28. do i = 1 to Frames
  29.     call open TempFile,"RAM:VFXNums",W
  30.     call writeln TempFile,right(i,5,'0')
  31.     call writeln TempFile,right(Frames,5,'0')
  32.     call close TempFile
  33.     f=0
  34.     Redraw Off
  35.     FieldSet = 0
  36.     if Padding ~= -1 & i = 1 then call PadIt(1)
  37.     call LoadB()
  38.     call LoadA()
  39.     j = j+ 1
  40.     call DoIt()
  41.     Redraw On
  42.     call SaveIt()
  43.         if Field = 1 then do
  44.             Redraw Off
  45.             FieldSet = 1
  46.             call LoadB()
  47.             call LoadA()
  48.             j = j + 1
  49.             call DoIt()
  50.             Redraw On
  51.             call SaveIt()
  52.             end 
  53.     if Padding ~= -1 & i = Frames then call PadIt(2)
  54.     end
  55.     if SaveType = 0 then do
  56.         if Padding = -1 then
  57.             call MakeIcon(SaveName,(Frames-10))
  58.         else
  59.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  60.         end
  61.     Undo On
  62. exit
  63.  
  64.  
  65. PadIt:
  66. arg PadNum
  67.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  68.         Undo On
  69.         exit
  70.         end
  71.          if PadNum = 1 then do
  72.        if IAType = 0 then do
  73.         do Pad = Padding to 1 by -1
  74.             LoadBuffer PicAName Force StartA-(Pad-1)
  75.             call Switcher(TOSW)
  76.             call Switcher(MDV1)
  77.             Render Go
  78.                 call RecordAdd(SaveName,2,6,Compression)
  79.             end
  80.         end
  81.        if IAType = 1 then do
  82.         LoadBuffer PicAName Force 1
  83.         call Switcher(TOSW)
  84.         call Switcher(MDV1)
  85.         Render Go
  86.             call RecordAdd(SaveName,2*Padding,6,Compression)
  87.         end
  88.        if IAType = 2 then do
  89.         LoadBuffer PicAName Force
  90.         call Switcher(TOSW)
  91.         call Switcher(MDV1)
  92.         Render Go
  93.             call RecordAdd(SaveName,2*Padding,6,Compression)
  94.         end
  95.        if IAType = 3 then do
  96.         do Pad = Padding to 1 by -1
  97.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  98.             call Switcher(TOSW)
  99.             call Switcher(MDV1)
  100.             Render Go
  101.                 call RecordAdd(SaveName,2,6,Compression)
  102.             end
  103.         end
  104.     end 
  105.     else do
  106.        if IBType = 0 then do
  107.         do Pad = 1 to Padding
  108.             LoadBuffer PicBName Force StartB+Pad+Frames
  109.             call Switcher(TOSW)
  110.             call Switcher(MDV1)
  111.             Render Go
  112.                 call RecordAdd(SaveName,2,6,Compression)
  113.             end
  114.         end
  115.        if IBType = 1 then do
  116.         LoadBuffer PicBName Force 1
  117.         call Switcher(TOSW)
  118.         call Switcher(MDV1)
  119.         Render Go
  120.             call RecordAdd(SaveName,2*Padding,6,Compression)
  121.         end
  122.        if IBType = 2 then do
  123.         LoadBuffer PicBName Force
  124.         call Switcher(TOSW)
  125.         call Switcher(MDV1)
  126.         Render Go
  127.             call RecordAdd(SaveName,2*Padding,6,Compression)
  128.         end
  129.        if IBType = 3 then do
  130.         do Pad = 1 to Padding
  131.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  132.             call Switcher(TOSW)
  133.             call Switcher(MDV1)
  134.             Render Go
  135.                 call RecordAdd(SaveName,2,6,Compression)
  136.             end
  137.         end
  138.     end
  139. return
  140.  
  141. LoadA:
  142.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  143.         Undo On
  144.         exit
  145.         end
  146.     if j = TFrames then return
  147.     if IAType = 0 then do
  148.         LoadBuffer PicAName Force i+StartA
  149.         end
  150.     if IAType = 1 then do
  151.         LoadBuffer PicAName Force 1
  152.         end
  153.     if IAType = 2 then do
  154.         LoadBuffer PicAName Force
  155.         end
  156.     if IAType = 3 then do
  157.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  158.         end
  159.  
  160.  
  161. return
  162.  
  163. LoadB:
  164.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  165.         Undo On
  166.         exit
  167.         end
  168.     if j = 1 then return
  169.     if IBType = 0 then do
  170.         LoadBuffer PicBName Force i+StartB
  171.         end
  172.     if IBType = 1 then do
  173.         LoadBuffer PicBName Force 1
  174.         end
  175.     if IBType = 2 then do
  176.         LoadBuffer PicBName Force
  177.         end
  178.     if IBType = 3 then do
  179.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  180.         end
  181.     Swap
  182. return
  183.  
  184.  
  185. DoIt:
  186.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  187.         Undo On
  188.         exit
  189.         end
  190.     if j = TFrames then do
  191.         Swap
  192.         return
  193.         end
  194.     if j = 1 then do
  195.         GetMain
  196.         parse var result Name Width Height Blah
  197.         return
  198.         end
  199.  
  200.     Num = (((j-1) * 100)/(TFrames-1))
  201.     Num = trunc(Num)
  202.     Hook Composite MERGE Num 1 0 0 MatchMain SwapScale
  203.  
  204.     Buffer2Swap
  205.  
  206.  
  207.     if Type = 0 then do
  208.         ReliefMap 256 0
  209.         end
  210.     if Type = 1 then do
  211.         Hook "Hooks/Sys/SobelEdge"  
  212.         end
  213.     if Type = 2 then do
  214.         Color2Grey 333 334 333
  215.         Grey2Color
  216.         end
  217.     if Type = 3 then do
  218.         Negative
  219.         end
  220.     if Type = 4 then do
  221.         EdgeDetect 1
  222.         Negative
  223.         Sharpen 200
  224.         end
  225.     if Type = 5 then do
  226.         ColorToGrey 299 587 114
  227.         Grey2Color
  228.         Hook "Hooks/Sys/Antique"
  229.         end
  230.     if Type = 6 then do
  231.         Hook ApplyTexture Texture 0 256 SHINY
  232.         end
  233.     if Type = 7 then do
  234.         Contrast 255
  235.         Gamma 255
  236.         end
  237.     if Type = 8 then do
  238.         Contrast 255
  239.         end
  240.     if Type = 9 then do
  241.         Gamma 255
  242.         end
  243.  
  244.     Swap
  245.  
  246.     ByNum = 100
  247.     NewNum = ((j-1)*ByNum)/((TFrames/2)-1)
  248.     if j > (TFrames/2) then
  249.         NewNum = ((ByNum -(((j-1) * ByNum)/(TFrames-1)))%1)*2
  250.     NewNum = trunc(NewNum)
  251.     if NewNum > 100 then NewNum = 100
  252.     if NewNum = 100 then Swap
  253.     else Hook Composite MERGE NewNum 1 0 0 MatchMain
  254.  
  255.     ActiveColor 16
  256.     Pen 0 1
  257.     Box 0 0 Width Height
  258.     ActiveColor 1
  259.  
  260. return
  261.  
  262. SaveIt:
  263.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  264.         Undo On
  265.         exit
  266.         end
  267.     if SaveType = 0 then do
  268.         call Switcher(TOSW)
  269.         call Switcher(MDV1)
  270.  
  271.         Render Go
  272.         if Field = 1 then
  273.                 call RecordAdd(SaveName,1,6,Compression)
  274.         else
  275.                 call RecordAdd(SaveName,2,6,Compression)
  276.         end
  277.  
  278.     if SaveType = 1 then do
  279.         if Field = 1 then do
  280.             f= f + 1
  281.             if f = 1 then
  282.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  283.             if f = 2 then do
  284.                 GetMain
  285.                 parse var result Name Width Height Blah
  286.                 Scale Width Height/2
  287.                 Swap
  288.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  289.                 Scale Width Height/2
  290.                 Hook Interlace
  291.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  292.                 f = 0
  293.                 end
  294.             end
  295.         else do
  296.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  297.             end    
  298.         end
  299.  
  300. return
  301.  
  302.  
  303.